<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  
</head>
<body>
  <div id="app">
    <!-- 事件中可以直接 修改 vm上数据 -->
    <!-- <button v-on:click="msg = '数据修改了'">按钮</button>
    <button v-on:click="fn">按钮</button>
    <button v-on:click="fn2('这是传入的值')">按钮2</button> -->
    <button @click="msg = '数据修改了'">按钮</button>
    <button @click="fn">按钮</button>
    <button @click="fn2('这是传入的值')">按钮2</button>
    {{msg}}
  </div>
  <script src="./vue.js"></script>
  <script>
      const vm = new Vue({
        // 绑定vm到 视图上， 定义vm控制视图的范围
        el: '#app',
        data: {
          msg: '你好世界'
        },
        methods: {
          fn(){
            this.msg = '事件函数中修改数据';
          },
          fn2(msg){
            this.msg = msg;
          }
        }
      })
    
  </script>
</body>
</html>